package com.yaosheng.thread.threadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by yaosheng on 2021/7/6.
 */
public class SingleThreadPool {

    public static void main(String[] args) {

        ExecutorService service = Executors.newSingleThreadExecutor ();
        for(int i = 0;i < 5;i ++){
            final int j = i;
            service.execute ( () -> {
                System.out.println (j + " " + Thread.currentThread ().getName ());
            });
        }
    }
}
